home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 2002 November / SGI IRIX 6.5 Applications 2002 November.iso / dist / sgi_apache.idb / etc / init.d / sgi_apache.z / sgi_apache
Encoding:
Text File  |  2002-06-27  |  4.2 KB  |  205 lines

  1. #!/bin/sh
  2. #Tag 0x00000f00
  3. #
  4. # $Revision: 1.6 $
  5. #
  6. IS_ON=/sbin/chkconfig
  7. NSS_ENABLED=0
  8.  
  9. if [ -f /var/netscape/fasttrack/bin/httpd/ns-httpd ]
  10. then
  11.   if $IS_ON nss_fasttrack
  12.   then
  13.     NSS_ENABLED=1
  14.   fi
  15. fi
  16.  
  17. if $IS_ON verbose; then
  18.     ECHO=echo
  19.     ECHOFD=1
  20. else        # For a quiet startup and shutdown
  21.     ECHO=:
  22.     ECHOFD=-
  23. fi
  24.  
  25. SGI_APACHE_HOME=/var/sgi_apache
  26. SROOT=$SGI_APACHE_HOME/httpd-*
  27.  
  28. SVCONFIGURE=$SGI_APACHE_HOME/sgi_config/configure
  29.  
  30. #
  31. # Warning:  the freeware apache is config'd on...
  32. #
  33. if $IS_ON apache
  34. then
  35.   APACHE_HOME=/usr/freeware/apache
  36.   if [ -f $APACHE_HOME/etc/httpd.conf ]
  37.   then
  38.      FA_PORT=`grep "^Port " $APACHE_HOME/etc/httpd.conf | awk '{ print $2 }'`
  39.      if [ "FA_PORT" = "80" ]
  40.      then
  41.        echo "sgi_apache:"
  42.        echo "**"
  43.        echo "** WARNING:  the Freeware Apache server seems to be configured"
  44.        echo "**           to run on port 80.  The Freeware server will not"
  45.        echo "**           starup properly since the sgi_apache server will"
  46.        echo "**           already be running on port 80..."
  47.        echo "**"
  48.      fi
  49.   fi
  50. fi
  51.  
  52. #
  53. #
  54. case "$1" in
  55.     start)
  56.     if $IS_ON sgi_apache; then
  57. #
  58. # Warning:  don't start if nss_fasttrack is enabled...
  59. #
  60. if [ $NSS_ENABLED -eq 1 ]
  61. then
  62.     echo "sgi_apache:"
  63.     echo "**"
  64.     echo "** WARNING:  you must disable nss_fasttrack on this system"
  65.     echo "**           in order to allow sgi_apache to startup;"
  66.     echo "**"
  67.     echo "**           1. chkconfig nss_fasttrack off"
  68.     echo "**           2. reboot"
  69.     echo "**"
  70.     echo "**"
  71.     exit
  72.     fi
  73. # ------------>>
  74. #
  75.         $SVCONFIGURE
  76.  
  77.                 $ECHO "Starting SGI Web Server(s)"
  78.         for s in $SROOT
  79.         do
  80.             # Note: skip the httpd-gateway directory since it's
  81.             #       handled by the /etc/init.d/webface script...
  82.             #
  83.             case `basename $s`
  84.             in
  85.             ( httpd-gateway ) ;;
  86.             ( * )
  87.             if [ -d $s ]
  88.             then
  89.             if [ -x $s/sbin/apachectl ]
  90.             then
  91.                 $ECHO "$s"
  92.                 $s/sbin/apachectl start >&$ECHOFD 2>&$ECHOFD
  93.                 if [ $? -ne 0 ]
  94.                 then
  95.                 $ECHO "Cannot start $s."
  96.                 fi
  97.             else
  98.                 $ECHO "$s"
  99.                 $ECHO "Missing 'apachectl' for $s."
  100.             fi
  101.             fi ;;
  102.             esac
  103.         done
  104.     fi
  105.     ;;
  106.     restart)
  107.     if $IS_ON sgi_apache; then
  108. #
  109. # Warning:  restart may not work if nss_fasttrack is enabled...
  110. #
  111. if [ $NSS_ENABLED -eq 1 ]
  112. then
  113.     echo "sgi_apache:"
  114.     echo "**"
  115.     echo "** WARNING:  you won't be able to restart sgi_apache until"
  116.     echo "**           after you disable nss_fasttrack on this system;"
  117.     echo "**"
  118.     echo "**           1. chkconfig nss_fasttrack off"
  119.     echo "**           2. reboot"
  120.     echo "**"
  121.     echo "**"
  122.     exit
  123.     fi
  124. # ------------>>
  125. #
  126.         $SVCONFIGURE
  127.  
  128.                 $ECHO "Restarting SGI Web Server(s)"
  129.         for s in $SROOT
  130.         do
  131.             # Note: skip the httpd-gateway directory since it's
  132.             #       handled by the /etc/init.d/webface script...
  133.             #
  134.             case `basename $s`
  135.             in
  136.             ( httpd-gateway ) ;;
  137.             ( * )
  138.             if [ -d $s ]
  139.             then
  140.             if [ -x $s/sbin/apachectl ]
  141.             then
  142.                 $ECHO "$s"
  143.                 $s/sbin/apachectl restart >&$ECHOFD 2>&$ECHOFD
  144.                 if [ $? -ne 0 ]
  145.                 then
  146.                 $ECHO "Cannot restart $s."
  147.                 fi
  148.             else
  149.                 $ECHO "$s"
  150.                 $ECHO "Missing 'apachectl' for $s."
  151.             fi
  152.             fi ;;
  153.             esac 
  154.         done
  155.     fi
  156.     ;;
  157.     stop)
  158.     if $IS_ON sgi_apache; then
  159.         $SVCONFIGURE
  160.  
  161.                 $ECHO "Stopping SGI Web Server(s)"
  162.         for s in $SROOT
  163.         do
  164.             # Note: skip the httpd-gateway directory since it's
  165.             #       handled by the /etc/init.d/webface script...
  166.             #
  167.             case `basename $s` 
  168.             in
  169.             ( httpd-gateway ) ;;
  170.             ( * )
  171.             if [ -d $s ]
  172.             then
  173.             if [ -x $s/sbin/apachectl ]
  174.             then
  175.                 $ECHO "$s"
  176.                 $s/sbin/apachectl stop >&$ECHOFD 2>&$ECHOFD
  177.                 if [ $? -ne 0 ]
  178.                 then
  179.                 $ECHO "Cannot stop $s."
  180.                 fi
  181.             else
  182.                 $ECHO "$s"
  183.                 $ECHO "Missing 'apachectl' for $s."
  184.             fi
  185.             fi ;;
  186.             esac
  187.         done
  188.     fi
  189.     ;;
  190.     rotate)
  191.     if $IS_ON sgi_apache; then
  192.                 echo "sgi_apache:"
  193.                 echo "**"
  194.         echo "** WARNING:  Unable to rotate SGI Web Server(s) Logs."
  195.         echo "**           This should be configured in the individual"
  196.                 echo "**           sgi_apache httpd.conf files..."
  197.                 echo "**"
  198.     fi
  199.     ;;
  200.  
  201.     *)
  202.         echo "usage: $0 {start|stop|restart|rotate}"
  203.     ;;
  204. esac
  205.